home
diamond Go Premium
Data Engineering Path  ·  PySpark

MapReduce Execution Tracing: Web Access Logs

Series Data Engineering & Distributed Systems Series
Estimated Time ~40 Mins Lab
Lab Objective

Trace raw HTTP web access log records step-by-step through the Map, Combiner, Partitioner, Shuffle/Sort, and Reduce execution stages.


Input Dataset & Parameters

Raw HTTP Logs:

Timestamp IP Address Request Type Status Code Response Time
2026-05-25T12:00:01 192.168.1.5 GET 200 120 ms
2026-05-25T12:00:02 192.168.1.8 POST 500 450 ms
2026-05-25T12:00:03 192.168.1.5 GET 200 95 ms
2026-05-25T12:00:04 192.168.1.12 GET 404 45 ms
2026-05-25T12:00:05 192.168.1.8 POST 200 180 ms
2026-05-25T12:00:06 192.168.1.5 POST 500 600 ms

Goal & Cluster Setup:

  • Goal: Compute Average Response Time for successful requests (status_code == 200), grouped by ip_address.
  • Split 1 (Mapper A): Rows 1, 2, 3.
  • Split 2 (Mapper B): Rows 4, 5, 6.
  • Partitioner: Partition = ip_address_last_octet % 2 (2 Reducers).

Execution Trace Solution

1. Map Phase (Emitting Sum & Count Tuples)

Each mapper reads its assigned log split and emits key-value pairs of (ip_address, (response_time, count)) for successful requests (status_code == 200):

  • Mapper A (Split 1): Emits [("192.168.1.5", (120, 1)), ("192.168.1.5", (95, 1))] (Row 2 with 500 status code is filtered out).
  • Mapper B (Split 2): Emits [("192.168.1.8", (180, 1))] (Rows 4 & 6 with non-200 status codes are filtered out).

2. Combiner Phase (Local Pre-Aggregation)

Aggregates intermediate values locally on each mapper node to minimize network transfer during shuffle:

  • Combiner A: Combines IP 192.168.1.5: Sums time 120+95=215, Count 1+1=2 → Emits ("192.168.1.5", (215, 2)).
  • Combiner B: Emits ("192.168.1.8", (180, 1)).

3. Shuffle & Partitioner Routing Phase

Computes partition routing using last_octet % 2 to distribute intermediate keys to Reducers:

  • Reducer 0 (even octet, e.g., 8 % 2 = 0): Receives ("192.168.1.8", [(180, 1)]).
  • Reducer 1 (odd octet, e.g., 5 % 2 = 1): Receives ("192.168.1.5", [(215, 2)]).

4. Reduce Phase & Final Output

Divides aggregated total response times by response counts to output final averages:

  • Reducer 0 Final Output: ("192.168.1.8", 180.0 ms) (Calculated as 180ms / 1 request).
  • Reducer 1 Final Output: ("192.168.1.5", 107.5 ms) (Calculated as 215ms / 2 requests).

Final Results Table

IP Address Successful Requests Total Time (ms) Avg Response Time
192.168.1.5 2 215 ms 107.5 ms
192.168.1.8 1 180 ms 180.0 ms
Find this content helpful? ☕ Buy me a coffee

Entity Details

Create New Item

celebration
Enjoying the free content?

Create a free account to track your progress and save your place.

Create Free Account
help

Submit Technical Query

Have a question or run into an issue? Describe it below, upload an optional screenshot, and our engineering team will answer it!

image Attach image (optional)

Submit Feedback

build Free Developer Utility Free Tool
gavel

Privacy & Legal Disclaimer

1. Client-Side Browser Processing

All utility tools on DeepEngineerHub (including Image to PDF, Text Formatters, JSON Converters, and Encryptors) execute 100% locally within your client browser using WebAssembly and JavaScript. No uploaded images, text, or documents are transmitted, collected, or stored on remote servers.

2. Limitation of Liability ("As-Is" Provision)

Tools and services are provided free of charge for convenience and educational purposes "as-is" without warranties of any kind. DeepEngineerHub shall not be held liable for any data loss, formatting inconsistencies, or indirect damages resulting from tool usage.

3. Open Source & Third-Party Software

Certain utilities utilize open-source client libraries (such as jsPDF, Mermaid.js, Pyodide) licensed under MIT, Apache, or BSD open licenses. All intellectual property remains with their respective copyright holders.